//
//  ZXDownloadManager.h
//  ZXDownload
//
//  Created by xin on 2018/5/3.
//  Copyright © 2018年 魏鑫. All rights reserved.
//  参考了多个下载工程，建议还是用代理相对灵活性更大
/*
 *  0.0.1 主要功能
 *  下载文件
 *  设置下载文件的目录设置、缓存目录设置
 *  观察下载文件的进度情况，更新UI
 *  记录并查看下载中的列表，已完成的列表
 */

#import <Foundation/Foundation.h>
#import "ZXDownloadFile.h"
#import <UIKit/UIKit.h>

@protocol ZXDownloadManagerDelegate <NSObject>


@end

@protocol ZXDownloadControlProtocol <NSObject>

- (void)suspendWithURL:(NSString * _Nonnull)url;
- (void)suspendWithDownloadFile:(ZXDownloadFile * _Nonnull)file;

- (void)removeWithURL:(NSString * _Nonnull)url;
- (void)removeWithDownloadFile:(ZXDownloadFile * _Nonnull)file;

@end

@interface ZXDownloadManager : NSObject <ZXDownloadControlProtocol>

@property (nonatomic, weak) id<ZXDownloadManagerDelegate> delegate;

+ (nonnull instancetype)sharedManager;

- (ZXDownloadFile *)downloadFileWithURL:(NSString *)url progress:(void (^)(NSProgress * progress,ZXDownloadFile * file))progress success:(void (^)(NSURL *url))success failure:(void (^)(NSError *error))failure;

- (ZXDownloadFile *)getDownloadFileForURL:(NSString *)url;


@end
